<template>
  <div>
    <Parent
      :parentData="parentData.parent"
      v-if="parentData.parent"
      @parentCallReply="diguiParentReply"
      :level="level-1"
    />
    <div class="parentContent">
      <div class="info">
        <div class="name">第{{level}}楼 {{parentData.user.nickname}}</div>
        <div class="data">2小时前</div>
        <div class="btnReply" @click="parentCallReply">回复</div>
      </div>
      <div class="main">{{parentData.content}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Parent",
  props: ["parentData", "level"],
  methods: {
    parentCallReply() {
      this.$emit("parentCallReply", this.parentData.id);
    },
    diguiParentReply(parentId) {
      this.$emit("parentCallReply", parentId);
    }
  }
};
</script>

<style lang='less' scoped>
.parentContent {
  border: 1px solid #ccc;
  padding: 2.778vw;
  background-color: #eee;
  .info {
    display: flex;
    align-items: center;
    .data {
      font-size: 3.333vw;
      color: #666;
      flex: 1;
      padding-left: 2.778vw;
    }
    .btnReply {
      font-size: 3.333vw;
      color: #888;
    }
  }
  .main {
    padding: 2.778vw 0;
  }
}
</style>